﻿using Jay.Sc2.Bof.Lib.State;

namespace Jay.Sc2.Bof.Lib.Action.Protoss
{
	public abstract class ActionProduceProtoss : ActionProduce
	{
		public ActionProduceProtoss(int buildTime, int minerals, int gas, int food) : base(buildTime, minerals, gas, food) { }
		public override bool IsInvalid(IBuildOrder bo)
		{
			ProtossState state = bo.State as ProtossState;
			if (bo.State.Minerals < Minerals && bo.State.WorkersOnMinerals == 0) return true;
			if (bo.State.Gas < Gas && bo.State.WorkersOnGas == 0) return true;
			if (!bo.State.HaveSupply(Food) && (bo.State.SupplyBuilding + bo.State.Supply - (bo.State.Food + Food) <= 0)) return true;
			return false;
		}
	}
}
